-- background: 3675 from stack: in -- bmap block id: 2165 -- flags: 4000 -- background id: 0 -- name: Client Card -- part 1 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=112 top=77 right=105 bottom=350 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Client Name ----- HyperTalk script ----- on closeField scanForOldClient end closeField -- SCAN EXISTING CARDS TO SEE IF AN ACCOUNT FOR THIS CLIENT ALREADY -- EXISTS. IF SO, THEN SKIP CONFLICTS PROCEDURE AND INCREMENT -- EXISTING ACCOUNT NUMBER BY 1 TO ASSIGN NEW SUBACCOUNT. on scanForOldClient global temp1,temp2,adrs,tphone set cursor to 4 set lockScreen to true show msg at 17,246 put "Now searching stack to see if this is an existing client" put line 1 of field "Client Name" into oldClient push card put "abcd" into temp1 put 1 into temp2 repeat with y = 2 to the number of cards -1 go to card y if line 1 of field "Client Name" contains oldClient then put field "Client Number" into temp1 put field "Address" into adrs put field "Phone" into tphone set numberFormat to 000 add 1 to temp2 end if end repeat pop card if temp1 contains "abcd" then scanForConflicts -- no account yet for this client else assignNewSubaccount -- account already exists end if end scanForOldClient -- HAVEN'T FOUND AN EXISTING ACCOUNT FOR THIS CLIENT; -- SCAN ADVERSE PARTY FIELD OF ALL PREVIOUS CARDS FOR CONFLICTS on scanForConflicts set cursor to 4 set lockScreen to false push card repeat with i = 1 to the number of words of field "Client Name" show msg at 17,246 put word i of field "Client Name" into conflict if conflict contains "Mr." or conflict contains "Mrs." or conflict contains "Miss" or conflict contains "Ms." or conflict contains "and" or conflict contains "of" then next repeat put "Searching for conflict with:" && quote & conflict & quote repeat with j = 2 to the number of cards go to card j if conflict is in field "Adverse" then beep 3 put "Conflict found with:" && quote & conflict & quote into msg wait 1 seconds put "NOTE: Answering " & quote & "No" & quote & " will delete new card" answer "Do you want to continue search for conflicts?" with "No" or "Yes" if it is "No" then pop card doMenu Delete Card hide msg exit scanForConflicts else put "Searching for conflict with:" && quote & conflict & quote next repeat end if else next repeat end if end repeat end repeat pop card assignClientNumber end scanForConflicts -- NO CONFLICTS FOUND WITH NEW CLIENT; ASSIGN A NEW ACCOUNT NUMBER on assignClientNumber -- format is xxyy.zzz put "Now assigning a new account number to this client" if word 1 of field "Client Name" contains "Mr" or word 1 of field "Client Name" contains "Ms" or word 1 of field "Client Name" contains "Miss" then put char 1 of last word of field "Client Name" into temp3 else put char 1 of line 1 of field "Client Name" into temp3 end if set numberFormat to 00 put the charToNum of temp3 - 64 into temp3 -- ASCII equivalent set numberFormat to 00 put the number of cards-1 into temp4 -- number accounts consecutively add 0 to temp4 put temp3 & temp4 & ".001" into field "Client Number" -- subaccount # hide msg set the name of this card to field "Client Number" end assignClientNumber on assignNewSubaccount global temp1,temp2,adrs,tphone put "Now assigning a new subaccount number for this client" repeat 3 times delete last char of temp1 -- strip subaccount numbers end repeat put temp1 & temp2 into field "Client Number" -- temp1 is existing account number; temp2 # of existing subaccounts+1 put adrs into field "Address" put tphone into field "Phone" hide msg set the name of this card to field "Client Number" end assignNewSubaccount -- part 3 (field) -- low flags: 01 -- high flags: 4000 -- rect: left=423 top=44 right=58 bottom=493 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Client Number ----- HyperTalk script ----- -- part 4 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=112 top=113 right=166 bottom=350 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Address -- part 5 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=112 top=177 right=191 bottom=349 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Phone -- part 6 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=112 top=196 right=210 bottom=350 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Matter -- part 7 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=124 top=250 right=264 bottom=350 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Referral -- part 9 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=124 top=267 right=281 bottom=163 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Fee_Quote -- part 10 (button) -- low flags: 00 -- high flags: A003 -- rect: left=358 top=76 right=90 bottom=406 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Sort ----- HyperTalk script ----- on mouseUp sort by field "Client Number" end mouseUp -- part 11 (button) -- low flags: 00 -- high flags: A003 -- rect: left=426 top=76 right=90 bottom=478 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: New ----- HyperTalk script ----- on mouseUp go to last card doMenu "New Card" end mouseUp -- part 13 (button) -- low flags: 00 -- high flags: A003 -- rect: left=358 top=92 right=108 bottom=480 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Time Slips ----- HyperTalk script ----- on mouseUp go to stack "Time Slips" end mouseUp -- part 8 (field) -- low flags: 00 -- high flags: 4000 -- rect: left=151 top=285 right=325 bottom=384 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Adverse ----- HyperTalk script ----- -- part 17 (field) -- low flags: 01 -- high flags: 4007 -- rect: left=356 top=177 right=248 bottom=490 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: Descrip -- part 20 (button) -- low flags: 00 -- high flags: A003 -- rect: left=359 top=126 right=142 bottom=481 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Adjust Fees ----- HyperTalk script ----- on mouseUp ask "Please enter new hourly rate:" with "125" put it into newFee if newFee ≠ field "Fee_Quote" then set cursor to 4 set lockScreen to true set lockMessages to true put newFee into field "Fee_Quote" put field "Client Number" into clNum push card go to stack "Time Slips" repeat with x = 2 to the number of cards go to card x if field "Client Number" contains clNum then put newFee into field "Hourly" send "computeBill quarterHours" to target end if end repeat pop card send mouseUp to bkgnd button "Amt. Due" set lockScreen to false set lockMessages to false end if end mouseUp -- part 21 (button) -- low flags: 00 -- high flags: A003 -- rect: left=359 top=143 right=158 bottom=481 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Amt. Due ----- HyperTalk script ----- on mouseUp global accumulateFees,accumulateDisb put field "Client Number" into clNum set cursor to 4 set lockScreen to true set lockMessages to true push card go to stack "Time Slips" put 0 into accumulateFees put 0 into accumulateDisb repeat with x = 2 to the number of cards go to card x if field "Client Number" contains clNum then set numberFormat to 0.00 add field "Total Bill" to accumulateFees end if end repeat go to stack "Disbursements" put 0 into accumulateDisb repeat with x = 2 to the number of cards go to card x if field "Client Number" contains clNum then add field "Total Disb" to accumulateDisb end if end repeat pop card set lockScreen to false set lockMessages to false put "Balance Outstanding:" into line 1 of field "Descrip" put "Fees: $" & accumulateFees into line 2 of field "Descrip" put "Disbursements: $" & accumulateDisb into line 3 of field "Descrip" end mouseUp -- part 22 (button) -- low flags: 00 -- high flags: A003 -- rect: left=360 top=159 right=173 bottom=481 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Prepare Bill ----- HyperTalk script ----- on mouseUp global clNumber,atty,hrs,rte,totfees,header,bodyofBill,bodyofDisb, accumulateFees, accumulateDisb set lockRecent to true set lockScreen to true set lockMessages to true set cursor to 4 get hilite of button "All Bills" of card "Configure" if it is true then checkConfiguration else put "false" into atty put "false" into hrs put "false" into rte put "false" into totfees end if constructHeader assembleFees assembleDisbursements writeBill set lockRecent to false set lockScreen to false set lockMessages to false play boing end mouseUp on checkConfiguration -- SET FLAGS FOR BILLING FORMAT; APPARENTLY, THIS MUST BE DONE BEFORE -- SWITCHING TO ANOTHER STACK global atty,hrs,rte,totfees get hilite of button "Hours" of card "Configure" if it is true then put "true" into hrs else put "false" into hrs end if get hilite of button "Rate" of card "Configure" if it is true then put "true" into rte else put "false" into rte end if get hilite of button "Total Fees" of card "Configure" if it is true then put "true" into totfees else put "false" into totfees end if get hilite of button "Attorney" of card "Configure" if it is true then put "true" into atty else put "false" into atty end if end checkConfiguration on constructHeader -- CONSTRUCT LETTERHEAD AND MAILING ADDRESS INFORMATION global header,clNumber put return & return & return & tab & tab & tab & "Peter B. Nagel" & return into header put tab & tab & tab & "710 Dahlia Street" & return after header put tab & tab & tab & "Denver, Colorado 80220" & return after header put tab & tab & tab & "CompuServe 75036,3423" & return after header put field "Client Name" into clName put field "Address" into clAddress put field "Matter" into clMatter put field "Client Number" into clNumber put return & return & return & clName & tab & tab & "Client Number: " & clNumber & return after header put clAddress & return & return after header put "Re: " & clMatter & return & return & return after header put "STATEMENT OF SERVICES RENDERED AS OF " & the long date & ":" & return after header end constructHeader on assembleFees -- ASSEMBLE DESCRIPTION OF SERVICES RENDERED AND OUTSTANDING FEES global clNumber,atty,hrs,rte,totfees,bodyofBill,accumulateFees push card go to stack "Time Slips" put field "Attorney Name" of card "Cover Card" into attyName put 0 into accumulateFees -- needs to be initialized set numberFormat to 0.00 add 0 to accumulateFees -- to trigger number format put empty into bodyofBill -- initialization repeat with x = 2 to the number of cards go to card x if field "Client Number" contains clNumber then add field "Total Bill" to accumulateFees put return & return & field "Date" & ":" & return & field "Narrative" & return after bodyofBill if atty contains true then -- if "Attorney" format was selected put tab & attyName after bodyofBill end if if hrs contains true then -- if "Hours" format was selected put space && space && field "Total Time" && "hours" after bodyofBill end if if rte contains true then -- if "Rate" format was selected put space && space && "$" & field "Hourly" && "per hour" after bodyofBill end if if totfees contains true then -- if "Fees" format was selected put space && space && "$" & field "Total Bill" after bodyofBill end if end if end repeat end assembleFees on assembleDisbursements -- ASSEMBLE INFORMATION ABOUT EXPENSES INCURRED global clNumber,bodyofDisb,accumulateDisb go to stack "Disbursements" put 0 into accumulateDisb -- needs to be initialized set numberFormat to 0.00 add 0 to accumulateDisb -- to trigger number format put empty into bodyofDisb -- initialization repeat with x = 2 to the number of cards go to card x if field "Client Number" contains clNumber then add field "Total Disb" to accumulateDisb put field "Description" into descripHolder -- don't alter field repeat for (40-the number of chars of descripHolder) times put space after descripHolder end repeat -- extends "Description" field out to 40 characters -- so that dollar entries will line up properly put return & field "Date" & ":" & return & descripHolder & "$" & field "Total Disb" & return & return after bodyofDisb end if end repeat pop card end assembleDisbursements on writeBill global clNumber,header,bodyofBill,bodyofDisb, accumulateFees,accumulateDisb --FIRST PUT TOTAL BALANCES DUE IN DESCRIPTION FIELD OF CARD put "Balance Outstanding:" into line 1 of field "Descrip" -- just to show balance on client card put "Fees: $" & accumulateFees into line 2 of field "Descrip" put "Disbursements: $" & accumulateDisb into line 3 of field "Descrip" --SEND BILLING INFORMATION TO TEXT FILE FOR EDITING --NOTE THAT THIS WILL SAVE BILL IN SAME FOLDER AS THIS STACK get the long name of this stack -- includes full pathname put it into preBill delete first word of preBill -- deletes "stack" delete first char of preBill -- deletes initial ' " ' delete last char of preBill -- deletes final ' " ' repeat two times delete last word of preBill -- deletes "Client List" end repeat repeat 6 times delete last char of preBill -- deletes "Master" end repeat put clNumber & " Bill" after preBill -- name of new text document open file preBill write header to file preBill -- starts with client address & matter write bodyofBill to file preBill write return & return & return & return & "DISBURSEMENTS:" & return & return to file preBill write bodyofDisb to file preBill write return & return & return & "TOTAL FEES: $" & accumulateFees to file preBill write return & return & "TOTAL DISBURSEMENTS: $" & accumulateDisb to file preBill write return & return & "TOTAL AMOUNT DUE: $" & accumulateFees + accumulateDisb to file preBill close file preBill end writeBill -- part 24 (button) -- low flags: 00 -- high flags: A003 -- rect: left=358 top=109 right=125 bottom=481 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Disbursements ----- HyperTalk script ----- on mouseUp go to stack "Disbursements" end mouseUp -- part 31 (button) -- low flags: 00 -- high flags: 2000 -- rect: left=468 top=311 right=330 bottom=493 -- title width / last selected line: 0 -- icon id / first selected line: 16560 / 16560 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Next ----- HyperTalk script ----- on mouseUp visual effect wipe left go to next card end mouseUp -- part 32 (button) -- low flags: 00 -- high flags: 2000 -- rect: left=14 top=312 right=330 bottom=39 -- title width / last selected line: 0 -- icon id / first selected line: 15420 / 15420 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Prev ----- HyperTalk script ----- on mouseUp visual effect wipe right go to previous card end mouseUp -- part 33 (button) -- low flags: 00 -- high flags: A003 -- rect: left=378 top=254 right=270 bottom=459 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Clear All ----- HyperTalk script ----- on mouseUp repeat with x = 1 to the number of fields put empty into field x end repeat end mouseUp